open(FH,"</Users/yaping/Documents/lab/project/SNP/Normal_SNP.chr11.7M-9M.txt") or die;
my @in=<FH>;
chomp(@in);
close(FH);
my @out;
my @out_txt;
foreach my $line(@in){
	if($line=~/(\S+)\t(\S+)\t(\d+)\t(\w)\t(\w)\t\w\t\w/){
		my $name = $1;
		my $chr = $2;
		my $region = $3;

		if($region <= 9000000 && $region >= 7000000){
			next if $chr ne "11";
			$chr = "chr".$chr;

			my $start=$region-1;
			my $end=$region;
			push(@out,"$chr\t$start\t$end\t$name\t0\t+\n");
		
			
		}
		#next if $chr eq "X";
		#$chr = "chr".$chr;
		
	#	my $start=$region-1;
	#	my $end=$region;
	#	push(@out,"$chr\t$start\t$end\t$name\t0\t+\n");
	#	push(@out_txt,"$line\n");
	}
}
open(OUT,">/Users/yaping/Documents/lab/project/SNP/Normal_SNP.chr11.7M-9M.bed");
print OUT @out;
close(OUT);

#open(OUT,">/Users/yaping/Documents/lab/project/SNP/Normal_SNP.filterCNV.autosome.cpg.txt");
#print OUT @out_txt;
#close(OUT);